using System.Collections;

namespace MDSAdministration
{
    public class SortMDSGroups : IComparer
    {
        public int Compare(object x, object y)
        {
            var cx = (ComparedObject)x;
            var cy = (ComparedObject)y;

            string strX = "";
            string strY = "";

            if (cx.Location == "Same")
            {
                strX = "zzz" + cx.ObjectName;
                
            }
            else
            {
                strX = cx.Location + cx.ObjectName;
            }

            if (cy.Location == "Same")
            {
                strY = "zzz" + cy.ObjectName;

            }
            else
            {
                strY = cy.Location + cy.ObjectName;
            }

            return strX.CompareTo(strY);
        }
    }
}